import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int a = in.nextInt(), b = in.nextInt();
        int count = 0;
        for (int i = a; i <= b; i++) {
            count += bitCount(i);
        }
        System.out.println(count);
    }


    public static int bitCount(int n) {
        int count = 0;
        while (n != 0) {
            int t = n % 10;
            if (t == 2) count++;
            n /= 10;
        }
        return count;
    }
}
